package com.myidis.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.myidis.entity.QuotaProvider;

public interface QuotaProviderMapper {
	@Select("SELECT * FROM quota_provider")
    @Results({
    	@Result(property = "id", column = "id"),
    	@Result(property = "name", column = "name"),
        @Result(property = "description", column = "description")
    })
    List<QuotaProvider> all();
	
    @Select("SELECT * FROM quota_provider WHERE id = #{id}")
    @Results({
    	@Result(property = "id", column = "id"),
    	@Result(property = "name", column = "name"),
        @Result(property = "description", column = "description")
    })
    QuotaProvider getOne(int id);
    
	@Insert("INSERT INTO quota_provider(name, description) VALUES(#{name}, #{description})")
    int insert(QuotaProvider quotaType);

    @Update("UPDATE quota_provider SET id = #{id}, name = #{name}, description = #{description} WHERE id = #{id}")
    int update(QuotaProvider quotaType);

    @Delete("DELETE FROM quota_provider WHERE id = #{id}")
    int delete(int id);
}
